 <template>
  <div style="padding: 10px 15px">
    <div class="date_line">
      <div class="box2" read>
        <div
          v-for="item in dayrectabber"
          :key="item.selected"
          :class="[
            item.selected == dayrecselectcount ? 'active2' : '',
            'item3',
          ]"
          :data-select="item.selected"
          @click="dayrectabChange"
        >
          {{ item.title }}
        </div>
      </div>
      <el-select
        v-model="year"
        class="year_select"
        @change="yearchange($event)"
      >
        <el-option
          v-for="item in yearoptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <el-tabs
        v-model="activeName"
        class="el-menu-demo"
        @tab-click="tabhandleClick"
      >
        <el-tab-pane
          :label="m.mothName"
          :name="m.moth"
          v-for="m in moths"
          :key="m.moth"
        >
          <div>
            <div class="moth_left" v-for="(n, index) in days" :key="n.day">
              <div class="moth_number" :class="{ blu: changeRed == index }">
                <span
                  v-if="n.day <= 9"
                  class="moth_number_span"
                  :class="{ notshouw: !n.isShow }"
                  @click="n.isShow ? dayclick(n.day, m.moth, index) : ''"
                  >{{ n.day }}</span
                >
                <span
                  v-if="n.day > 9"
                  class="moth_number_span2"
                  :class="{ notshouw: !n.isShow }"
                  @click="n.isShow ? dayclick(n.day, m.moth, index) : ''"
                  >{{ n.day }}</span
                >
              </div>

              <div
                class="moth_cycle"
                v-if="!n.isDif"
                :class="{ moth_cyclehui: !n.isShow }"
              ></div>
              <div
                class="moth_cyclered"
                v-if="n.isDif"
                :class="{ moth_cyclehui: !n.isShow }"
              ></div>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>

    <!-- 查询条件-->
    <div class="filter-container">
      <el-input
        v-model="listQuery.title"
        placeholder="请输入支付账户"
        style="width: 200px"
        class="filter-item"
        @keyup.enter.native="handleFilter"
      />
      <el-select
        v-if="this.user.cpnId == sy"
        v-model="form.cpnID"
        clearable
        filterable
        class="filter-item"
        placeholder="请选择企业"
        :filter-method="cpnmatch"
        @clear="cpnmatch"
      >
        <el-option
          v-for="item in cpnoptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
          <span v-html="item.label" />
        </el-option>
      </el-select>

      <el-select
        v-model="form.payTyp"
        clearable
        class="filter-item"
        placeholder="请选择支付方式"
      >
        <el-option
          v-for="item in paytypeoptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
          <span v-html="item.label" />
        </el-option>
      </el-select>
      <el-select
        v-model="form.payChannel"
        clearable
        filterable
        class="filter-item"
        placeholder="请选择支付通道"
      >
        <el-option
          v-for="item in paytychanneloptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
          <span v-html="item.label" />
        </el-option>
      </el-select>
      <el-button
        class="filter-item seachbttn"
        type="primary"
        icon="el-icon-search"
        @click="handleFilter"
        >查询</el-button
      >
      <el-button
        class="filter-item seachbttn"
        type="primary"
        @click="handleFilter(2)"
      >
        清空
      </el-button>
    </div>
    <div
      class="filter_fenge"
      style="border: none; border-top: 1px solid #d1ddeb"
    ></div>
    <div class="filter-container">
      <el-button
        v-if="Jurisdiction('添加')"
        class="filter-item bttnleft"
        type="primary"
        icon="el-icon-edit"
        @click="handleCreate"
        >新增</el-button
      >
      <el-button
        v-if="Jurisdiction('删除')"
        class="filter-item"
        type="danger"
        icon="el-icon-delete"
        @click="deleteClick()"
        >删除</el-button
      >
      <el-button
        class="filter-item bttnleft"
        type="primary"
        icon="el-icon-download"
        @click="exportFormVisible = true"
        >导出</el-button
      >
      <el-button
        class="filter-item"
        type="primary"
        icon="el-icon-refresh"
        @click="OpenUpdateRcncbtch(sy)"
        >更新对账</el-button
      >
      <!--
         <el-button
        class="filter-item"
        type="primary"
        icon="el-icon-refresh"
        @click="rfFilter"
        >刷新</el-button
      >
      -->
    </div>
    <!--查询条件 end-->

    <!--table-->
    <el-table
      v-loading="listLoading"
      :data="RcncbtchData"
      fit
      highlight-current-row
      style="width: 100%"
      stripe
    >
      <!--  <el-table-column label="差账笔数" align="right" width="100px">
        <template slot-scope="{ row }">
          <span v-if="row.error > 0" class="red">{{ row.error }}</span>
          <span v-if="row.error == 0">{{ row.error }}</span>
        </template>
      </el-table-column>
     -->

      <el-table-column
        label="日期"
        align="left"
        width="100px"
        min-width="150px"
      >
        <template slot-scope="{ row }">
          <span>{{ row.dtStr }}</span>
        </template>
      </el-table-column>
      <el-table-column label="企业" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.cpnIDStr }}</span>
        </template>
      </el-table-column>
      <el-table-column label="机构" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.orgIDStr }}</span>
        </template>
      </el-table-column>
      <el-table-column label="支付账户" align="left" min-width="300px">
        <template slot-scope="{ row }">
          <span>{{ row.act }}</span>
        </template>
      </el-table-column>

      <el-table-column label="方式-渠道" align="left" min-width="220px">
        <template slot-scope="{ row }">
          <span>{{ row.payStr }}</span>
        </template>
      </el-table-column>

      <el-table-column label="对账结果" align="left" width="100px">
        <template slot-scope="{ row }">
          <span v-if="row.error > 0" class="red">异常</span>
          <span v-if="row.error == 0" class="green">正常</span>
        </template>
      </el-table-column>

      <el-table-column label="差异金额" align="right" width="100px">
        <template slot-scope="{ row }">
          <span v-if="row.error > 0" class="red">{{ row.errorMonyStr }}</span>
          <span v-if="row.error == 0">0</span>
        </template>
      </el-table-column>

      <el-table-column label="差异笔数" align="right" width="100px">
        <template slot-scope="{ row }">
          <span v-if="row.error > 0" class="red">{{ row.error }}</span>
          <span v-if="row.error == 0">0</span>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="300">
        <template slot-scope="scope">
          <el-button
            v-if="Jurisdiction('编辑')"
            type="primary"
            size="mini"
            @click="handleClick(scope.row)"
            >编辑</el-button
          >
          <el-button
            v-if="scope.row.error > 0"
            type="primary"
            size="mini"
            @click="OpenDifOrds(scope.row)"
            >查看对账明细</el-button
          >
          <el-button
            v-if="scope.row.error > 0"
            type="primary"
            size="mini"
            @click="OpenRcnHandRcd(scope.row)"
            >订单处理记录</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="listQuery.total > 0"
      :total="listQuery.total"
      :page.sync="listQuery.page"
      :limit.sync="listQuery.limit"
      @pagination="fetchData(this)"
    />

    <!--table end -->

    <!--弹出层  新增-->
    <el-dialog
      :title="textMap[dialogStatus]"
      :visible.sync="dialogFormVisible"
      width="55%"
    >
      <el-form :model="form" :inline="true" label-position="right">
        <el-form-item label="主键编号">
          <el-input v-model="form.id" />
        </el-form-item>
        <el-form-item label="对账日期">
          <el-input v-model="form.dt" />
        </el-form-item>
        <el-form-item label="对账批次(企业+机构+支付方式+支付渠道+账户+日期)">
          <el-input v-model="form.btchId" />
        </el-form-item>
        <el-form-item label="企业">
          <el-input v-model="form.cpnID" />
        </el-form-item>
        <el-form-item label="机构">
          <el-input v-model="form.orgID" />
        </el-form-item>
        <el-form-item label="支付方式">
          <el-input v-model="form.payTyp" />
        </el-form-item>
        <el-form-item label="支付渠道">
          <el-input v-model="form.payChannel" />
        </el-form-item>
        <el-form-item label="支付账户">
          <el-input v-model="form.act" />
        </el-form-item>
        <el-form-item label="西联支付平台实收金额">
          <el-input v-model="form.xLAmtMony" />
        </el-form-item>
        <el-form-item label="西联支付平台实收笔数">
          <el-input v-model="form.xLAmtCount" />
        </el-form-item>
        <el-form-item label="第三方平台平台实收金额">
          <el-input v-model="form.tHAmtMony" />
        </el-form-item>
        <el-form-item label="第三方平台平台实收笔数">
          <el-input v-model="form.tHAmtCount" />
        </el-form-item>
        <el-form-item label="西联支付平台退款金额">
          <el-input v-model="form.xLAmtMonyRfd" />
        </el-form-item>
        <el-form-item label="西联支付平台退款笔数">
          <el-input v-model="form.xLAmtCountRfd" />
        </el-form-item>
        <el-form-item label="第三方平台平台退款金额">
          <el-input v-model="form.tHAmtMonyRfd" />
        </el-form-item>
        <el-form-item label="第三方平台平台退款笔数">
          <el-input v-model="form.tHAmtCountRfd" />
        </el-form-item>
        <el-form-item label="对账方式">
          <el-input v-model="form.typ" />
        </el-form-item>
        <el-form-item label="处理状态">
          <el-input v-model="form.dealStt" />
        </el-form-item>
        <el-form-item label>
          <el-input v-model="form.rcncbtchTyp" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveForm">确 定</el-button>
      </div>
    </el-dialog>

    <!--详情-->
    <el-dialog title="详情" :visible.sync="dialogdetailsVisible" width="55%">
      <el-form :model="details_form" :inline="true" label-position="right" />
    </el-dialog>

    <el-dialog title="导出" :visible.sync="exportFormVisible" width="20%">
      <el-form :model="downloadform" :inline="true" label-position="right">
        <el-button
          class="filter-item"
          type="primary"
          icon="el-icon-download"
          :loading="downloadform.nowexportLoading"
          @click="Export(false)"
          >按当前页导出</el-button
        >
        <el-button
          class="filter-item"
          type="primary"
          icon="el-icon-download"
          :loading="downloadform.allexportLoading"
          @click="Export(true)"
          >全部导出</el-button
        >
      </el-form>
    </el-dialog>

    <el-dialog
      class="updatercform"
      title="更新账单"
      :visible.sync="updaterctFormVisible"
      width="20%"
    >
      <el-form :model="updatercform" :inline="true" label-position="right">
        <el-form-item v-if="this.user.cpnId == sy" label="企业" prop="cpnid">
          <el-select
            v-model="updatercform.cpnid"
            filterable
            clearable
            class="filter-item"
            placeholder="请选择企业"
            style="width: 80%"
          >
            <el-option
              v-for="item in cpnoptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="日期" prop="dt">
          <el-date-picker
            v-model="updatercform.dt"
            style="width: 80%"
            type="date"
            placeholder="请选择日期"
            format="yyyy-MM-dd"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="UpdateRcncbtch">确 定</el-button>
      </div>
    </el-dialog>
    <!--弹出层 end-->
  </div>
</template>

<script>
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import { AjaxToken, TipConfirm } from "@/api/common";
import { SelectAjax } from "@/api/common";
import { Jurisdiction } from "@/api/common";
import sessionStorage from "@/api/Storage";
import "url-search-params-polyfill";
import commconfig from "@/comm.json";
import PinYinMatch from "pinyin-match";

export default {
  name: "Rcncbtch",
  components: { Pagination },
  data() {
    return {
      changeRed: -1,
      yearoptions: [],
      moths: [],
      days: [],
      year: "",
      dayrectabber: [
        {
          title: "日",
          selected: 1,
        },
        {
          title: "周期",
          selected: 0,
        },
      ],
      dayrecselectcount: 1,

      activeName: "1月",
      activeIndex: "01",
      sy: "system",
      user: null,
      multipleSelection: [],
      formLabelWidth: "120px",
      RcncbtchData: null,
      downloadform: {
        allexportLoading: false,
        nowexportLoading: false,
      },
      updatercform: {
        cpnid: "",
        update: "",
      },
      listQuery: {
        title: "",
        total: 0,
        page: 1,
        limit: 10,
        date: "",
      },
      listLoading: true,
      dialogFormVisible: false,
      dialogdetailsVisible: false,
      updaterctFormVisible: false,
      cpnoptions: [],
      paytypeoptions: [],
      paytychanneloptions: [],
      exportFormVisible: false,
      dialogStatus: "",
      textMap: {
        update: "修改",
        create: "添加",
      },
      form: {
        id: "",
        dt: "",
        btchId: "",
        cpnID: "",
        orgID: "",
        payTyp: "",
        payChannel: "",
        act: "",
        xLAmtMony: "",
        xLAmtCount: "",
        tHAmtMony: "",
        tHAmtCount: "",
        xLAmtMonyRfd: "",
        xLAmtCountRfd: "",
        tHAmtMonyRfd: "",
        tHAmtCountRfd: "",
        typ: "",
        eRPAmtMony: "",
        eRPAmtCount: "",
        eRPAmtMonyRfd: "",
        eRPAmtCountRfd: "",
        dealStt: "",
        rcncbtchTyp: "",
      },
      details_form: {
        id: "",
        dt: "",
        btchId: "",
        cpnID: "",
        orgID: "",
        payTyp: "",
        payChannel: "",
        act: "",
        xLAmtMony: "",
        xLAmtCount: "",
        tHAmtMony: "",
        tHAmtCount: "",
        xLAmtMonyRfd: "",
        xLAmtCountRfd: "",
        tHAmtMonyRfd: "",
        tHAmtCountRfd: "",
        typ: "",
        eRPAmtMony: "",
        eRPAmtCount: "",
        eRPAmtMonyRfd: "",
        eRPAmtCountRfd: "",
        dealStt: "",
        rcncbtchTyp: "",
      },
    };
  },
  mounted() {},
  // 初始化
  created() {
    var user = JSON.parse(sessionStorage.getItem("userinfo"));
    this.user = user;
    this.updatercform.cpnid = user.cpnId;
    this.fetchData();
    backstage.GeCpntListItems(this);
    backstage.GetPayTypeList(this);
    backstage.GetPyChannelSelectListItems(this);
    var params = new URLSearchParams();
    params.append("CpnId", user.cpnId);
    backstage.GetRcncbtchDateLine(this, params);
  },
  methods: {
    cpnmatch(val) {
      if (val) {
        let result = [];
        this.cpnoptions.forEach((item) => {
          let matchRes = PinYinMatch.match(item.label, val);
          if (matchRes) {
            result.push(item);
          }
        });
        this.cpnoptions = result;
      } else {
        this.cpnid = "";
        this.cpnoptions = backstage.GeCpntListItems(this);
      }
    },

    yearchange(e) {
      var params = new URLSearchParams();
      params.append("year", e);
      params.append("CpnId", this.user.cpnId);
      backstage.GetRcncbtchDateLine(this, params, e);
    },
    dayclick(day, moth, index) {
      this.changeRed = index;
      var params = new URLSearchParams();
      var date = this.year + "-" + moth + "-" + day;
      this.listQuery.date = date;
      this.fetchData();
    },
    tabhandleClick(tab, event) {
      var params = new URLSearchParams();
      params.append("month", tab.name);
      params.append("CpnId", this.user.cpnId);
      params.append("year", this.year);
      backstage.GetRcncbtchDateLine(this, params, this.year);
    },
    dayrectabChange(data) {
      var that = this;
      that.dayrecselectcount = data.currentTarget.dataset.select;
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    Export(Export) {
      if (Export) {
        this.downloadform.allexportLoading = true;
      } else {
        this.downloadform.nowexportLoading = true;
      }
      backstage.RcncbtchExport(this, Export);
    },
    OpenUpdateRcncbtch(cpnif) {
      this.updaterctFormVisible = true;
    },
    UpdateRcncbtch(cpnif) {
      var params = new URLSearchParams();
      params.append("CpnID", this.updatercform.cpnid);
      params.append(
        "StDt",
        new Date(this.updatercform.dt).toLocaleDateString()
      );

      if (
        this.updatercform.cpnid == "" ||
        this.updatercform.cpnid == undefined
      ) {
        this.$message({
          showClose: true,
          message: "请选择企业",
          type: "error",
        });
        return;
      } else if (
        this.updatercform.dt == "" ||
        this.updatercform.dt == undefined
      ) {
        this.$message({
          showClose: true,
          message: "请选择日期",
          type: "error",
        });
        return;
      } else {
        backstage.UpdateRcncbtch(this, params);
        // 关闭弹窗
        this.updaterctFormVisible = false;
      }
    },
    // 权限
    Jurisdiction(moduleActionName) {
      return Jurisdiction(moduleActionName, this);
    },
    //多选
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // 多选赋值
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    // 搜索
    handleFilter(typ) {
      if (typ == 2) {
        this.listQuery.page = 1;
        this.listQuery.title = "";
        this.form = {
          cpnID: "",
          payTyp: "",
          payChannel: "",
        };
        this.fetchData();
      } else {
        this.listQuery.page = 1;
        this.fetchData();
      }
    },
    rfFilter() {
      this.listQuery = { title: "", total: 0, page: 1, limit: 10, date: "" };
      this.changeRed = -1;
      this.fetchData();
    },
    // 新增
    handleCreate() {
      this.dialogStatus = "create";
      this.dialogFormVisible = true;
      this.form = {
        id: "",
        dt: "",
        btchId: "",
        cpnID: "",
        orgID: "",
        payTyp: "",
        payChannel: "",
        act: "",
        xLAmtMony: "",
        xLAmtCount: "",
        tHAmtMony: "",
        tHAmtCount: "",
        xLAmtMonyRfd: "",
        xLAmtCountRfd: "",
        tHAmtMonyRfd: "",
        tHAmtCountRfd: "",
        typ: "",
        eRPAmtMony: "",
        eRPAmtCount: "",
        eRPAmtMonyRfd: "",
        eRPAmtCountRfd: "",
        dealStt: "",
        rcncbtchTyp: "",
      };
    },
    // 编辑
    handleClick(row) {
      this.form.id = row.id;
      this.form.dt = row.dt;
      this.form.btchId = row.btchId;
      this.form.cpnID = row.cpnID;
      this.form.orgID = row.orgID;
      this.form.payTyp = row.payTyp;
      this.form.payChannel = row.payChannel;
      this.form.act = row.act;
      this.form.xLAmtMony = row.xLAmtMony;
      this.form.xLAmtCount = row.xLAmtCount;
      this.form.tHAmtMony = row.tHAmtMony;
      this.form.tHAmtCount = row.tHAmtCount;
      this.form.xLAmtMonyRfd = row.xLAmtMonyRfd;
      this.form.xLAmtCountRfd = row.xLAmtCountRfd;
      this.form.tHAmtMonyRfd = row.tHAmtMonyRfd;
      this.form.tHAmtCountRfd = row.tHAmtCountRfd;
      this.form.typ = row.typ;
      this.form.eRPAmtMony = row.eRPAmtMony;
      this.form.eRPAmtCount = row.eRPAmtCount;
      this.form.eRPAmtMonyRfd = row.eRPAmtMonyRfd;
      this.form.eRPAmtCountRfd = row.eRPAmtCountRfd;
      this.form.dealStt = row.dealStt;
      this.form.rcncbtchTyp = row.rcncbtchTyp;
      this.dialogStatus = "edit";
      this.dialogFormVisible = true;
    },
    // 保存
    saveForm() {
      var arr = this.multipleSelection;
      var params = new URLSearchParams();
      params.append("Id", this.form.id);
      params.append("Dt", this.form.dt);
      params.append("BtchId", this.form.btchId);
      params.append("CpnID", this.form.cpnID);
      params.append("OrgID", this.form.orgID);
      params.append("PayTyp", this.form.payTyp);
      params.append("PayChannel", this.form.payChannel);
      params.append("Act", this.form.act);
      params.append("XLAmtMony", this.form.xLAmtMony);
      params.append("XLAmtCount", this.form.xLAmtCount);
      params.append("THAmtMony", this.form.tHAmtMony);
      params.append("THAmtCount", this.form.tHAmtCount);
      params.append("XLAmtMonyRfd", this.form.xLAmtMonyRfd);
      params.append("XLAmtCountRfd", this.form.xLAmtCountRfd);
      params.append("THAmtMonyRfd", this.form.tHAmtMonyRfd);
      params.append("THAmtCountRfd", this.form.tHAmtCountRfd);
      params.append("Typ", this.form.typ);
      params.append("ERPAmtMony", this.form.eRPAmtMony);
      params.append("ERPAmtCount", this.form.eRPAmtCount);
      params.append("ERPAmtMonyRfd", this.form.eRPAmtMonyRfd);
      params.append("ERPAmtCountRfd", this.form.eRPAmtCountRfd);
      params.append("DealStt", this.form.dealStt);
      params.append("RcncbtchTyp", this.form.rcncbtchTyp);
      backstage.SaveRcncbtch(this, params);
      this.fetchData();
    },
    // 删除
    deleteClick(row) {
      var multis = [];
      var params = new URLSearchParams();
      if (row == undefined || row == "") {
        var arr = this.multipleSelection;
        if (arr == undefined || arr.length <= 0) {
          this.$message({
            showClose: true,
            message: "请至少选中一行",
            type: "error",
          });
          return;
        } else {
          for (var i = 0; i < arr.length; i++) {
            multis.push(arr[i].id);
          }
          params.append("delds", JSON.stringify(multis));
        }
      } else {
        multis.push(row.id);
        params.append("delds", JSON.stringify(multis));
      }
      this.$confirm("确认删除吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "error",
      })
        .then((a) => {
          this.listLoading = true;
          backstage.DelRcncbtch(this, params);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    // 查询
    fetchData() {
      this.listLoading = true;
      var params = new URLSearchParams();
      params.append(
        "Parms",
        '{"page":' +
          this.listQuery.page +
          ',"rows":' +
          this.listQuery.limit +
          "}"
      );
      params.append("Date", this.listQuery.date);
      params.append("Title", this.listQuery.title);
      params.append(
        "CpnID",
        this.form.cpnID == "" ? this.user.cpnId : this.form.cpnID
      );
      params.append("PyTypID", this.form.payTyp);
      params.append("PyChnlID", this.form.payChannel);
      params.append(
        "Tp",
        this.$route.query.tp == undefined ? "" : this.$route.query.tp
      );
      this.listLoading = true;
      backstage.GetRcncbtchLst(this, params);
    },
    // 跳转差异详情
    OpenDifOrds(row) {
      this.$router.push({
        path: "/Reconciliation/DifOrds",
        query: {
          btchid: row.btchId,
          act: row.act,
          paytype: row.payTyp,
          orgid: row.orgID,
        },
      });
    },
    // 订单处理记录
    OpenRcnHandRcd(row) {
      this.$router.push({
        path: "/Reconciliation/RcnHandRcd",
        query: { btchid: row.btchId },
      });
    },
  },
};
// 后台事件
var backstage = {
  RcncbtchExport: function (thisobj, Export) {
    var cpnid =
      thisobj.form.cpnID == "" ? thisobj.user.cpnId : thisobj.form.cpnID;
    var tp =
      thisobj.$route.query.tp == undefined ? "" : thisobj.$route.query.tp;
    var url =
      commconfig.baseapi +
      "RcncbtchExport?Parms=" +
      '{"page": "' +
      thisobj.listQuery.page +
      '","rows": "' +
      thisobj.listQuery.limit +
      '"}' +
      "&Export=" +
      Export +
      "&Title=" +
      thisobj.listQuery.title +
      "&PyTypID=" +
      thisobj.form.payTyp +
      "&Tp=" +
      tp +
      "&PyChnlID=" +
      thisobj.form.payChannel +
      "&cpnid=" +
      cpnid;
    if (Export) {
      thisobj.downloadform.allexportLoading = false;
    } else {
      thisobj.downloadform.nowexportLoading = false;
    }
    window.location.href = url;
  },
  // 获取Rcncbtch集合
  GetRcncbtchLst: function (thisobj, params) {
    AjaxToken(
      thisobj,
      "GetRcncbtchLst",
      params,
      "post",
      function (res) {
        thisobj.listLoading = false;
        var body = res.data.data;
        thisobj.RcncbtchData = body.rows;
        thisobj.listQuery.page = body.page;
        thisobj.listQuery.total = body.records;
      },
      function (err) {}
    );
  },
  GetRcncbtchDateLine: function (thisobj, params, year) {
    AjaxToken(
      thisobj,
      "GetRcncbtchDateLine",
      params,
      "post",
      function (res) {
        thisobj.listLoading = false;
        var body = res.data.data;
        thisobj.yearoptions = [];
        thisobj.moths = body.rcncbtchDateLineMothDTOs;
        thisobj.days = body.rcncbtchDateLineDayDTOs;
        body.rcncbtchDateLineYearDTOs.forEach((element) => {
          if (year == undefined || year == "") {
            thisobj.year = element.year;
          }

          thisobj.yearoptions.push({
            value: element.year,
            label: element.yearName,
          });
        });
      },
      function (err) {
        this.listLoading = false;
      }
    );
  },
  SaveRcncbtch: function (thisobj, params) {
    AjaxToken(
      thisobj,
      "SaveRcncbtch",
      params,
      "post",
      function (res) {
        var body = res.data;
        if (body.success) {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: "success",
            duration: 2000,
          });
          thisobj.fetchData();
          thisobj.dialogFormVisible = false;
        } else {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: "error",
          });
        }
      },
      function (err) {}
    );
  },
  DelRcncbtch: function (thisobj, params) {
    AjaxToken(
      thisobj,
      "DelRcncbtch",
      params,
      "post",
      function (res) {
        thisobj.listLoading = false;
        var body = res.data;
        if (body.success) {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: "success",
            duration: 2000,
          });
          thisobj.fetchData();
          thisobj.dialogFormVisible = false;
        } else {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: "error",
          });
        }
      },
      function (err) {}
    );
  },
  UpdateRcncbtch: function (thisobj, params) {
    AjaxToken(
      thisobj,
      "UpdateRcncbtch",
      params,
      "post",
      function (res) {
        thisobj.listLoading = false;
        var body = res.data;
        if (body.success) {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: "success",
            duration: 30000,
          });
          thisobj.fetchData();
          thisobj.dialogFormVisible = false;
        } else {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: "error",
          });
        }
      },
      function (err) {}
    );
  },
  GeCpntListItems: function (thisobj) {
    SelectAjax(
      "GeCpntListItems?val=" + thisobj.cpnid + "",
      function (response) {
        var body = response.data;
        thisobj.cpnoptions = [];
        body.data.forEach((element) => {
          thisobj.cpnoptions.push({
            value: element.value,
            label: element.text,
          });
        });
      },
      function (error) {}
    );
  },
  GetPayTypeList: function (thisobj) {
    SelectAjax(
      "GetPayTypeList?val=",
      function (response) {
        var body = response.data;
        thisobj.paytypeoptions = [];
        body.data.forEach((element) => {
          thisobj.paytypeoptions.push({
            value: element.value,
            label: element.text,
          });
        });
      },
      function (error) {}
    );
  },
  GetPyChannelSelectListItems: function (thisobj) {
    SelectAjax(
      "GetPyChannelSelectListItems?val=",
      function (response) {
        var body = response.data;
        thisobj.paytychanneloptions = [];
        body.data.forEach((element) => {
          thisobj.paytychanneloptions.push({
            value: element.value,
            label: element.text,
          });
        });
      },
      function (error) {}
    );
  },
  RgDay: function (days) {
    if (
      days == "" ||
      days == null ||
      days == undefined ||
      typeof days !== "number"
    ) {
      return false;
    }
    var res = ""; // 返回数据
    var today = new Date().getTime(); // 今天
    for (var i = 0; i < days; i++) {
      var _day = new Date(today - 86400000 * i);
      var year = _day.getFullYear();
      var month = _day.getMonth() + 1;
      var day = _day.getDate();
      month < 10 ? "0" + month : month;
      day < 10 ? "0" + day : day;
      // res.push(year + "-" + month + "-" + day);
      res = year + "-" + month + "-" + day;
    }
    return res;
  },
};
</script>
<style>
.date_line .el-menu-demo .el-tabs__header {
  left: 111px !important;
}

/* el-tabs__nav-wrap{
  width: calc(100%-111px) !important;
} */
.el-tabs__nav-wrap::after {
  width: calc(100% - 111px) !important;
}
/* ::v-deep.date_line .el-menu-demo .el-tabs__header{
 width: calc(100%-111px) !important;
} */
.date_line .el-menu-demo .el-tabs__header {
  width: calc(100%-111px) !important;
}
.date_line .el-input--medium .el-input__inner {
  border: none;
}
.updatercform .el-dialog__body {
  padding: 20px 20px !important ;
  color: #606266 !important ;
  font-size: 14px !important ;
  word-break: break-all !important ;
}
</style>
<style lang="scss" scoped>
.moth_left {
  float: left;
  padding: 0px 20px 10px 0px;
}
.moth_cycle {
  width: 6px;
  height: 6px;
  background: #6fe195;
  border-radius: 50%;
  opacity: 1;
  margin-top: 8px;
  position: relative;
  left: 9px;
}
.moth_cyclered {
  width: 6px;
  height: 6px;
  background: red;
  border-radius: 50%;
  opacity: 1;
  margin-top: 8px;
  position: relative;
  left: 9px;
}
.moth_number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  opacity: 1;
  cursor: pointer;
}
.moth_number_not {
  width: 24px;
  height: 24px;
  color: #fff;
  opacity: 1;
}
.blu {
  color: white;
  background: #409eff;
}
.notshouw {
  color: #b8c2cc;
}
.moth_cyclehui {
  background-color: #b8c2cc;
  cursor: none;
  pointer-events: none;
}
.moth_number_span {
  position: relative;
  left: 8px;
  top: 4px;
}
.moth_number_span2 {
  position: relative;
  left: 3px;
  top: 4px;
}
.date_line {
  background: #ffffff;
  opacity: 1;
  border-radius: 8px;
  margin-bottom: 15px;
  padding: 10px 10px 10px 10px;
}

.box2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  width: 140px;
  height: 40px;
  background: #ffffff;
  border: 1px solid #409eff;
  opacity: 1;
  border-radius: 20px;
  position: relative;
  top: 16px;
  pointer-events: none;
}
.item2 {
  width: 33%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  color: #409eff;
  font-size: 12px;
}
.item3 {
  width: 50%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  color: #409eff;
  font-size: 12px;
}
.active2 {
  border-radius: 20px;
  background: rgba(64, 158, 255, 1);
  color: white;
}
.year_select {
  position: relative;
  top: 24px;
  z-index: 1000;
  width: 100px;
}
</style>